<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	import="java.util.*,com.beans.*;" pageEncoding="ISO-8859-1"%>
	
<%! String BDayUser,bdate; %>	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
	function testClick() {
		/*var div = document.getElementById("sendmessage");
		div.style.width = "100px";
		div.style.height = "100px";
		div.style.color = "Black";
		if (div.style.display == "inline") {
			div.style.display = "none";
		} else {
			div.style.display = "inline";
		}*/
		var message = window.prompt("\nEnter your message", "Happy Birthday");
		while(message.length==0){
			alert("Please enter your message");
			 message = window.prompt("\nEnter your message", "Happy Birthday");
			 
		}
		
				
		var myform=document.getElementById("myform");
		myform.mailmessage.value=message;
		alert("Your wishes have been sent");
		myform.submit();
		
		
		
	}

	function showalert() {
		alert("Your wishes have been sent");
	}
</script>
</head>
<body>


	<div
		style="border: 5px solid #37B1CC; min-height: 400px; margin: 5px 0px 0px 5px;">
		<div align="center">
			<img src="image/hb.gif">
		</div>


		<%!ArrayList<BirthdayForm> tlist = null;%>
		<%
			tlist = (ArrayList<BirthdayForm>) request.getAttribute("currentBirthdayList");

			if (!tlist.isEmpty()) {
		%>
		<div style="border: 3px solid #37B1CC;">
			<div
				style="font-style: oblique; font-size: 25px; border: 2px solid white; background-color: #37B1CC; color: white; font-weight: 900;">
				&nbsp;&nbsp;Today Birthdays</div>


			<%
				for (BirthdayForm birthdayForm : tlist) {
						String userName = birthdayForm.getUserName();
			%>
			<div style="min-height: 45px; border: 1px solid #37B1CC;">
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span><img
					src="image/15.jpg" height="60px" width="90px"
					style="vertical-align: middle;">
				</span> <span style="font-weight: bold; font-size: 17px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=userName%>&nbsp;&nbsp;</span>
				<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					
						<% String current_user=session.getAttribute("name").toString();
				           System.out.println(current_user+"......."+userName);
				        %>
				
				
				
				
				
					<% if(!current_user.equals(userName)){ %>
					<button id="wish" onclick="testClick()"
						style="font-size: 17px; color: #C7F2F2; background-color: #2CBBD1; font-family: cursive;">
						Wish &nbsp;<%=userName%>
						!
					</button> 
					<%} %></span>
			</div>


            
            <form id="myform" name="myform" action="SendMailAction.do" method="post">
               <input type="hidden" name="mailmessage" id="mailmessage"> 
                           
            </form>
            
            
  
			
			
			<%
				}
			%>
		</div>

		<%
			}
		%>

		<div
			style="font-style: oblique; border: 3px solid white; font-size: 20px; color: white; background-color: #37B1CC; font-weight: 900; height: 25px; vertical-align: middle;">
			&nbsp;&nbsp;&nbsp;<u>Upcoming Birthdays</u>
		</div>

		<div style="clear: both; border: 1px solid #37B1CC; min-height: 85px">
			<%!ArrayList<BirthdayForm> mlist = null;%>
			<%
				mlist = (ArrayList<BirthdayForm>) request
						.getAttribute("birthdayList");
				if (!mlist.isEmpty()) {
			%>
			<%
				for (BirthdayForm birthdayForm : mlist) {
					    BDayUser = birthdayForm.getUserName();
						bdate = birthdayForm.getBirthDate();
						
						String d[]=bdate.split("-");
						bdate=d[2]+"/"+d[1]+"/"+d[0];
						
			%>
			<div style="border: 1px solid #2BA7AD;">
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <table height="50px" style="text-align: left;"><tr><td style="width:175px;margin: 20px;"><img
					src="image/13.jpg" height="60px" width="60px"
					style="vertical-align: middle;">
				</td><td style="font-weight: bold; font-size: 17px;margin: 8px;width: 200px;"><%=BDayUser%></td>
				<td style="font-weight: bold;padding: 8px;margin: 8px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=bdate%></td>
			
			</tr></table></div>
			<%
				}
			
				}
				
				else{%>
					<div style="border: 1px solid #2BA7AD;">
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <table height="50px" style="text-align: left;"><tr><td style="width:175px;margin: 20px;"><img
						src="image/13.jpg" height="60px" width="60px"
						style="vertical-align: middle;">
					</td><td style="font-weight: bold; font-size: 17px;margin: 8px;width: 200px;"><%=BDayUser%></td>
					<td style="font-weight: bold;padding: 8px;margin: 8px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=bdate%></td>
				
				</tr></table></div>
			<% 	}%>
			
		</div>

	</div>
</body>
</html>